home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_08_11
/
8n11085a
< prev
next >
Wrap
Text File
|
1990-09-16
|
636b
|
26 lines
# include <stdio.h>
typedef int Truth;
class File { // Implementation layered on FILE
public:
File( char *name = "", char *mode = "r") { /* implemented as before */ }
~File() { if( fp) fclose( fp); }
Truth isok() { return state; }
Truth iseof() { return feof( fp); }
protected: // only visible to derived class member functions
int get() { return getc( fp); }
void unget(int c) { (void)ungetc( c, fp); }
int peek() { int c = get(); unget(c); return c; }
void put( int c) { putc( c, fp); }
private:
FILE *fp;
int state;
};